package com.doubi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doubi.entity.Releasetable;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ReleasetableMapper extends BaseMapper<Releasetable> {
    @Update("update releasetable set viewCounts = #{i} where releaseId=#{rid}")
    Integer addviewCounts(@Param("i") int i,@Param("rid")Integer rid);

    @Select("select COUNT(*) from releasetable where userId=#{userId} and classId=#{classId}")
    Integer getCount(@Param("userId")Integer userId,@Param("classId")Integer classId);

    //查询所有关注视频
    List<Releasetable> getReleasetableList(@Param("uid")List<Integer> uid);

    //查询不是自己账号的所有视频
    @Select("select * from releasetable where userId <> #{userId}")
    List<Releasetable> getIndexList(@Param("userId") Integer userId);

    //条件查询视频
    List<Releasetable> vedioConditionQuery(@Param("pageNo")Integer pageNo,@Param("pageSize")Integer pageSize, @Param("title") String title, @Param("classId") Integer classId, @Param("userName") String userName);
    //批量删除
    int delVideoByIds(@Param("videoIds") List<Integer> videoIds);
}
